Script for choosing vim background color
While choosing colors in gvim is very easy, done by a single :colorscheme some-name command, in contrast it's much harder for Vim users to do the same. Here is a small script which may help choosing a background color for Vim users. script: vim_bg_color_test.vim " script name : vim_bg_color_test.vim " " dedicated to choose a background color in Vim (not gvim), for ":hi Normal". " Needed here is an integer ranging from 0 to 255. (vs rgb values for gvim) " (Does color value effect depends on operating used ?) " (Here foreground color is set to black but script may help on choosing " foreground color too.) " " Execute this script from within Vim by ":source %" if you edit it currently. " Beginning and ending values are asked for in order to do a loop on colors. " The status line at the bottom of screen shows script effect. " Type a carriage-return after seeing color showed (and associated number). " " In principle the lot of highlight (:hi) options are well chosen by Vim " when ":hi Normal" options are set, while possibly adding in .vimrc (linux) : " :set background=dark or light " :set t_Co=256 " 08/08/2012 - alain_b "---------------------------------------------- let n=input("First number (0 to 255)") let n2=input("Last number (0 to 255)") while n <= n2 execute "hi Normal ctermfg=black ctermbg=".n execute input("Value ".n ) let n=n+1 endwhile " Initial display restored source ~/.vimrc Your vimrc should contain something like this: if has("gui_running") colorscheme peachpuff else set t_Co=256 "set background=dark " dark/light if useful " The ctermbg option has been chosen using vim_bg_color_test.vim script highlight Normal ctermfg=black ctermbg=222 endif Vim documentation gives only one example, for Vim users: :highlight Normal ctermfg=grey ctermbg=darkblue and Vim gives access to "colortest.vim" script which seems to me too difficult to tweak. Comments I don't understand what problem you're solving here. What's wrong with colorschemes in a color terminal? --Fritzophrenic (talk) 17:45, August 8, 2012 (UTC) :The problem is not with gvim (colorscheme is easy to use), as said, but with Vim. :Coming back to the script. It is working well inside Vim 7.3 on ubuntu. I am not sure it's ok everywhere, since selected background color may sometimes not be visible, on the bottom line of the screen. I don't know why. --Alain b, 17:46, October 9, 2012 ::Please spell out what the problem is (readers should not need to wonder about the purpose of a tip). Identify a system where there is a problem, then state what the problem is. Then mention how the tip overcomes the problem. Perhaps this is intended for some cut-down version of console Vim where color schemes don't work? I normally use gvim, but I'm pretty sure I have used color schemes on Windows and Linux in terminals (although I built them myself, so perhaps I had some feature enabled?). To sign a comment, add four tildes (~~~~) at the end of the last line. JohnBeckett (talk) 10:54, October 14, 2012 (UTC) You may throw away this tip. I didn't interpreted well how vim was working and thought colorscheme command was only for GUI usage. I use myself gvim and tried to help people choose quickly vim colors in a terminal. Sorry. Alain b (talk) 16:59, January 13, 2013 (UTC) :Thanks for the followup. No need to be sorry! JohnBeckett (talk) 11:04, January 15, 2013 (UTC)